;(function(){
    new Vue({
      el:'#rentFloorPlan',
      data:{
        imageUrl:null,
        allUnitData:null,
        locateUnitData:null
      },
      filters:{
        formatBusinessType: function(item) {
          return hlCodeConvert.businessType(item)
        },
      },
      methods:{
        getData:function(){
          if(window.sessionStorage.getItem('RENT_FLOOR_PLAN_IMAGE')){
            this.imageUrl = window.sessionStorage.getItem('RENT_FLOOR_PLAN_IMAGE')
          }
          if(window.sessionStorage.getItem('RENT_FLOOR_PLAN_DATA')){
            this.allUnitData = JSON.parse(window.sessionStorage.getItem('RENT_FLOOR_PLAN_DATA'))
          }
        },
        calculateLocation:function(){
          this.getData()
          // 15px 为去除最右边滚动条的宽度
          var screenWidth = window.innerWidth - 15;
          // 现接口返回的定位数据  基准宽度为 945px
          var scale = screenWidth / 945
          var unitData = []
          this.allUnitData.map(function(_item){
            var obj = {}
            if(_item.locateType === 'Y'){
              obj = JSON.parse(JSON.stringify(_item));
              obj['width'] = _item.width * scale;
              obj['height'] = _item.height * scale;
              obj['paddingLeft'] = _item.paddingLeft * scale;
              obj['paddingTop'] = _item.paddingTop * scale;
              unitData.push(obj)
            }
          })
          this.locateUnitData = unitData
        }
      },
      mounted:function(){
        this.calculateLocation()
      },
    })
}())
